﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Data;

namespace Presentation
{
    public partial class Grade : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btnSalvar_Click(object sender, EventArgs e)
        {

            try
            {
                TBGrade grade = new TBGrade();

                grade.Ano = Convert.ToInt32(txtAno.Text);
                grade.Semestre = ddlSemestre.SelectedValue;
                grade.IDCurso = Convert.ToInt32(ddlCurso.SelectedValue);

                using (DBUCNEntities banco = new DBUCNEntities())
                {
                    banco.AddToTBGrades(grade);
                    banco.SaveChanges();
                }

                Response.Redirect("Default.aspx");

            }
            catch (Exception)
            {

                throw;
            }
            
           
        }

        protected void ddlCurso_SelectedIndexChanged(object sender, EventArgs e)
        {

        }

    } 
}
